<?php
/*
# ------------------------------------------------------------------------
# JA Job Board Package
# ------------------------------------------------------------------------
# Copyright (C) 2004-2010 JoomlArt.com. All Rights Reserved.
# @license GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
# Author: JoomlArt.com
# Websites: http://www.joomlart.com - http://www.joomlancers.com.
# ------------------------------------------------------------------------
*/

defined('_JEXEC') or die('Retricted Access');

define('JBCOMNAME', 'com_jajobboard');
define('JBPREFIX', 'ja');
define('JBEMPLOYER_USER', "Employer User");
define('JBJOB_SEEKER_USER',  "Job Seeker User");
define('JBMODERATOR_USER',  "Moderator");
define('JBADMIN_USER',"Administrator");
define('JBSUPERADMIN',"Super Administrator");
define('JBADMINPREFIX','admin');

$backend_usertype = array(JBADMIN_USER, JBSUPERADMIN);
/**
 * Define permission name
 */
define('JBVIEWBLOCKFIELD','Can view blocked fields');
define('JBPOSTJOBFREE','Can Post job for free');
define('JBPOSTJOBPREMIUM','Can Premium Post for free');
define('JBPOSTPROFILE','Can post profile');
define('JBPOSTRESUME','Can post resume');
define('JBPAYMENT','Can submit payment');
define('JBDISPLAYCONTACT','Can display contact');
define('JBSEARCHPROFILE','Can search profile');
define('JBSEARCHRESUME','Can search resume');
define('JBVIEWRESUMEDETAIL','Can view resume detail');
define('JBVIEWPROFILEDETAIL','Can view profile detail');
define('JBVIEWJOBDETAIL','Can view job detail');
define('JBVIEWLISTJOBS','Can view list jobs');
define('JBVIEWLISTRESUMES','Can view list resumes');
define('JBVIEWLISTPROFILES','Can view list profiles');
require_once JPATH_SITE.DS.'components'.DS.JBCOMNAME.DS.'helper'.DS.'jafunctions.class.php';

class JobBoardConstant{
	
	
	function get_Version_Link()
	{
		$link = array();
				
		$link['current_version']['info'] = 'http://wiki.joomlart.com/wiki/JA_Job_Board/Overview';
		$link['current_version']['upgrade'] = 'http://www.joomlart.com/forums/downloads.php?do=cat';
		
		return $link;
	}
	function get_Variable_Email()
	{
		$variable = array();
		$variable[0]->value = '[USER_NAME]';
		$variable[0]->text = 'USER_NAME - User\'s name';
		$variable[1]->value = '[USER_EMAIL]';
		$variable[1]->text = 'USER_EMAIL - User\' email';
		$variable[2]->value = '[ADMIN_NAME]';
		$variable[2]->text = 'ADMIN_NAME - Administrator\'s name';
		$variable[3]->value = '[ADMIN_EMAIL]';
		$variable[3]->text = 'ADMIN_EMAIL - Administrator\'s email';
		$variable[4]->value = '[CONTACT_EMAIL]';
		$variable[4]->text = 'CONTACT_EMAIL - Email for user contacting';
		$variable[5]->value = '[SITE_URL]';
		$variable[5]->text = 'SITE_URL - Website\'s URL';
		$variable[6]->value = '[SITE_NAME]';
		$variable[6]->text = 'SITE_NAME - Site name';
		return $variable;
	}
	
	function getEmailConfig()
	{
		global $jbconfig;
		global $mainframe;
		$emailConfig = array();
		$emailConfig['site_contact_email'] = $jbconfig['emails']->get('fromemail');
		$emailConfig['site_title'] = $jbconfig['emails']->get('sitname');
		$emailConfig['root_url'] = $mainframe->getCfg('live_site');
		$emailConfig['fromemail'] = $jbconfig['emails']->get('fromemail');
		$emailConfig['fromname'] = $jbconfig['emails']->get('fromname');
		$emailConfig['admin_email'] = $jbconfig['emails']->get('fromemail');
		$emailConfig['admin_name'] = $jbconfig['emails']->get('fromname');
		return $emailConfig;
	}
	
	function get_Email_Group()
	{
		$result = array(
		JText::_("JobSeeker - Employer Join"),
		JText::_("Applications"),
		JText::_("Posting Plan - Credit Package"),
		JText::_("Subscriptions"),
		JText::_("Membership"),
		JText::_("Job Postings"),		
		JText::_("To Admin"),
		JText::_("Other")
		);
		return $result;
	}
	
	function getSub_Type()
	{
		$result = array(
		"jobseeker" => JText::_("Job Seeker"),
		"employer" => JText::_("Employer")//,
//		"recruiter" => "Recruiter"
		);
		return $result;
	}
	
	function getPostingPlan_Type()
	{
		$result = array(
			"standard" => JText::_("Standard Job"),
			"premium" => JText::_("Premium Job"),
			"resume" => JText::_("Search Resume")
		);
		return $result;
	}	
    /**
	* Get form list (manage fields)
	* @return Array Table list
	*/
	function getFormList(){
		$result = array(
			"3" => "Job Form",
			"1" => "Profile Form", 
			//"5" => "Employer Form", 
			"2" => "Resume Form", 
			//"6" => "Candidate Form", 
			
            "4" => "Application Form"
		);
		return $result;	
	}
    
    /**
	* Get table list (manage fields)
	* @return Array Table list
	*/
	function getTableList(){
		$result = array( 
			"ja_jobs" 		=> JText::_("Jobs Table"),
			"ja_profiles" 	=> "Profiles Table", 
			//"ja_employers" 	=> "Employers Table", 
			"ja_resumes" 	=> "Resumes Table", 
			//"ja_candidates" => "Candidates Table", 
			
            "ja_applications" => "Applications Table"
		);
		return $result;	
	}
	
	 /**
	* Get table list (manage fields)
	* @return Array Table list
	*/
	function getFieldStateList($state = null){
		$result = array(  
			"ins" 	=> JText::_("Inserted"), // insert as a record only, not update to db talbe
			"add" 	=> JText::_("Added"),    // updated to db table already
			"del" 	=> JText::_("Dropped"),  
			"mod"	=> JText::_("Modified"), // the field has been modified, not update to db table
			"chg" 	=> JText::_("Changed"),  // the field was modified and updated to the table
			"upd"	=> JText::_("Updated"),
			"drp" 	=> JText::_("Dropped"),  // marked to be dropped from db table
		);
		return empty($state)? $result : $result[$state];	
	}
	
	/**
	* Get events list (manage events of mouse)
	* @return Array event list
	*/
	function getEventList(){
		$result = array( 
			"onclick" 	=> "onClick", 
			"onchange" 	=> "onChange", 
			"onblur" 	=> "onBlur", 
			"onfocus" 		=> "onFocus"
		);
		return $result;	
	}
	
	/**
	* Get field type list (manage fields)
	* @return Array The field type list
	*/
	function getFieldTypeList($type=null){
		$result = array(
					"BLANK" 		=> JText::_("Blank Space"), 
					"BOOLEAN" 		=> JText::_("Boolean"),
					//"CHECK" 		=> JText::_("Check Boxes"), 					 
					"DATE" 	=> JText::_("Date"), 
					"DATE_CAL"       => JText::_('Date - Calendar'),
                    "FILE" 		=> JText::_('File Type'), 
					"IMAGE" 	=> JText::_('Image Type'),
					"INTEGER" 	=> JText::_('Integer'),
					"EDITOR"  	=> JText::_('HTML Editor'),
					"MSELECT"   	=> JText::_('Multiple Select'),
					"NUMERIC"   	=> JText::_('Numeric'),
					"RADIO"   	=> JText::_('Radio Buttons'),
					"SEPERATOR"   	=> JText::_('Seperator'),
					"SELECT"   	=> JText::_('Single Select'),
					"TEXTAREA"   	=> JText::_('Text Area'),
					"TEXTFIELD"   	=> JText::_('Text Field'),
					"PASS"   	=> JText::_('Password'),
					"URL"   	=> JText::_('URL'),
				  );
		return empty($type)? $result : $result[$type];	
	}
	
	/**
	* Get mapping from field type to mysql db type (manage fields)
	* @return string Asscociated db type
	*/
	function getMapDBType($fieldType = null){
		$result = array(					
					"BOOLEAN"   => "tinyint",					
					"BLANK" 		=> 'varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci ', 
					"DATE" 	=> 		"datetime", 
					"DATE_CAL"       => "datetime",
                    "FILE" 		=> "varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci ", 
					"IMAGE" 	=> "varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci ", 
					"INTEGER" 	=> "int",
					"EDITOR"  	=> "mediumtext CHARACTER SET utf8 COLLATE utf8_general_ci ",
					"MSELECT"   	=> "varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci ",
					"NUMERIC"   	=> 'float',
					"RADIO"   	=> "varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci ",
					"SEPERATOR"   	=> "varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci ",
					"SELECT"   	=> "varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci ",
					"TEXTAREA"   	=> "text CHARACTER SET utf8 COLLATE utf8_general_ci ",
					"TEXTFIELD"   	=> "varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci ",
					"PASS"   	=> "varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci ",
					"URL"   	=> "varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci ",
				  );
		return empty($fieldType)? $result : $result[$fieldType];
	}
	
	function getFieldValidationTypeList($validateType=null){
		$result = array(
					"" 			=> JText::_("Select Validation Type"), 
					"not_empty" => JText::_("Must not be empty"), 
					"number" 	=> JText::_('Must be number'),
					"email" 	=> JText::_('Must be a valid email'),
					"date"      => JText::_('Must be date format'),
					"time"      => JText::_('Must be time format'),
					"datetime"  => JText::_('Must be date time format'),
				  );
		return empty($validateType)? $result : $result[$validateType];
	}
    
    // The types of user that using this application
    function getUserType($userType=''){
       $result = array(
            "Employer User" => JText::_("Employer User"),
            "Job Seeker User" => JText::_("Job Seeker User"),
            "Administrator" => JText::_("Administrator")
       );
       return empty($userType)? $result : $result[$userType];         
       
    }
    

	
    function getUsergroup(){
    	$group = array();    
//    	$group['user']	=	array(""=>"Public Front-end","Registered"=>"Registered","Author"=>"Author","Editor"=>"Editor","Publisher"=>"Publisher");
		$group['admin']	=	array("0"=>"Public Back-end","Manager"=>"Manager","Administrator"=>"Administrator","Super Administrator"=>"Super Administrator");
		$group['user']	=	array("Guest"=>"Register","Job Seeker User"=>"Job Seeker User","Employer User"=>"Employer User");
//		$group['admin']	=	array("Administrator"=>"Administrator");
		return $group;
    }
    
	/**
	* Get component prefix
	* @return string ja_
	*/
	function getJBPrefix(){
	    return JBPREFIX;
	}
	
	/**
	* Get component name
	* @return string com_jajobboard
	*/
	function getComName(){
	    return JBCOMNAME;
	}
	
	
	function getStatus_Invoice(){
		$result = array(
			1 => JText::_("Completed"),
			0 => JText::_("Incompleted")
			
		);
		return $result;
	}
	
	
	function getAllowedExtend()
	{
		$str_allow_extend = "rtf,bmp,csv,doc,docx,epg,gif,ico,jpg,odg,odp,ods,odt,pdf,png,jpg,ppt,swf,txt,xcf,xls,xlsx,mpg,avi,divx,mp4,flv,wmv,mov,zip,rar";
		$result = explode(',',$str_allow_extend);
		return $result;
	}
	
	
	function getDisplayMode_ForSearchForm()
	{
		$result = array();
		$result[0] = new stdClass();
		$result[0]->value=1;
		$result[0]->text = JText::_('Normal');
		$result[0]->description= JText::_('Displaying this field like Form Cusmization');
		
		$result[1] = new stdClass();
		$result[1]->value=2;
		$result[1]->text = JText::_('Specific function');
		$result[1]->description= JText::_('Call php function to display this field');
		
		
		return $result;
	}
	
	function getSearchMode()
	{
		$result = array(1=>JText::_('Equal'),2=>JText::_('Less...than'),3=>JText::_('More...than'),4=>JText::_('Day ago'),5=>JText::_('Like'),6=>JText::_('In Set'));
		return $result;
	}
	
}
	  
?>
